#include <sstream>
#include <locale>

#include "from_yyyyddd_string.h"

using namespace std;
using namespace boost::gregorian;

date from_yyyyddd_string(const string &yyyyddd)
{
	date d(not_a_date_time);
	stringstream ss(yyyyddd);
	date_input_facet* facet(new date_input_facet("%Y%j"));
	ss.imbue(locale(ss.getloc(), facet));	
	ss >> d;

	return d;
}
